# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))


# -- Project information -----------------------------------------------------

project = 'Linux 常用 C 函数参考手册'
copyright = '2018-2025, 人人都懂物联网 GetIoT.tech'
author = '阿基米东'

# The full version, including alpha/beta/rc tags
release = 'v1.0'


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
    'recommonmark',
    'sphinx_markdown_tables'
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'zh_CN'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
#
# html_theme = 'sphinx_rtd_theme'
html_theme = 'sphinx_book_theme'

# Theme options are theme-specific and customize the look and feel of a theme
html_theme_options = {
    "show_navbar_depth": 2,
    "show_toc_level": 2,
    "navbar_align": "left",
    "navbar_center": False,
    "navbar_end": [],
    "navbar_persistent": [],
    "navbar_start": [],
    "primary_sidebar_end": [],
    "secondary_sidebar_items": ["page-toc"],
    "show_nav_level": 2,
    "show_prev_next": True,
    "toc_title": " 🐵",
    "use_edit_page_button": True,
    "use_repository_button": True,
    "use_issues_button": False,
    "use_download_button": False,
    "use_fullscreen_button": True,
    "use_sidenotes": False,
    "announcement": "",
    "icon_links": [],
    "icon_links_label": "Icon Links",
    "logo": {
        "text": "Linux C 函数手册",
    },
    # 仓库相关配置
    "repository_url": "https://github.com/getiot/linux-c-functions",
    "repository_branch": "main",
    "path_to_docs": "source",
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

html_logo = '_static/images/GetIoT_Logo_150px.png'
#html_favicon = '_static/images/GetIoT_Logo_32px.png'

html_js_files = [
    'js/baidutongji.js'
]

# 配置编辑页面和仓库按钮
html_context = {
    'display_github': True,
    'github_user': 'getiot',
    'github_repo': 'linux-c-functions',
    'github_version': 'main',
    'conf_py_path': '/source/',
}

# -- SEO 优化配置 -----------------------------------------------------

# 网站标题和描述
html_title = 'Linux C 函数大全 - 中文参考手册'
html_short_title = 'Linux C 函数大全'

# 网站描述和关键词
html_meta_description = 'Linux C 函数大全中文参考手册，包含字符测试、字符串转换、内存管理、文件操作、网络编程、进程管理、线程控制等19个分类的C语言函数详细说明和示例代码。'
html_meta_keywords = 'C语言函数,C语言参考手册,Linux C函数,C语言教程,C语言编程,字符测试,字符串转换,内存管理,文件操作,网络编程,进程管理,线程控制,信号处理,系统编程,GetIoT'

# 网站作者和版权信息
html_meta_author = '阿基米东'
html_meta_copyright = '2018-2025, 人人都懂物联网 GetIoT.tech'

# 网站语言和编码
html_meta_language = 'zh-CN'
html_meta_charset = 'utf-8'

# 网站图标和favicon
html_favicon = '_static/images/GetIoT_Logo_32px.png'

# 网站主题色和移动端优化
html_meta_viewport = 'width=device-width, initial-scale=1.0'

# 添加自定义元标签
html_meta_tags = [
    ('name', 'robots', 'index, follow'),
    ('name', 'googlebot', 'index, follow'),
    ('name', 'baiduspider', 'index, follow'),
    ('name', 'bingbot', 'index, follow'),
    ('name', 'format-detection', 'telephone=no'),
    ('name', 'theme-color', '#6c5ce7'),
    ('property', 'og:type', 'website'),
    ('property', 'og:title', 'Linux C 函数大全 - 中文参考手册'),
    ('property', 'og:description', 'Linux C 函数大全中文参考手册，包含字符测试、字符串转换、内存管理、文件操作、网络编程、进程管理、线程控制等19个分类的C语言函数详细说明和示例代码。'),
    ('property', 'og:url', 'https://getiot.tech/linux-c-functions/'),
    ('property', 'og:site_name', 'GetIoT.tech'),
    ('property', 'og:locale', 'zh_CN'),
    ('property', 'og:image', 'https://getiot.tech/linux-c-functions/_static/images/GetIoT_Logo_150px.png'),
    ('name', 'twitter:card', 'summary_large_image'),
    ('name', 'twitter:title', 'Linux C 函数大全 - 中文参考手册'),
    ('name', 'twitter:description', 'Linux C 函数大全中文参考手册，包含字符测试、字符串转换、内存管理、文件操作、网络编程、进程管理、线程控制等19个分类的C语言函数详细说明和示例代码。'),
    ('name', 'twitter:image', 'https://getiot.tech/linux-c-functions/_static/images/GetIoT_Logo_150px.png'),
]

# 网站结构化数据 (JSON-LD)
html_structured_data = '''
{
  "@context": "https://schema.org",
  "@type": "WebSite",
  "name": "Linux C 函数大全",
  "alternateName": "Linux C 函数参考手册",
  "description": "Linux C 函数大全中文参考手册，包含字符测试、字符串转换、内存管理、文件操作、网络编程、进程管理、线程控制等19个分类的C语言函数详细说明和示例代码。",
  "url": "https://getiot.tech/linux-c-functions/",
  "publisher": {
    "@type": "Organization",
    "name": "GetIoT.tech",
    "url": "https://getiot.tech",
    "logo": {
      "@type": "ImageObject",
      "url": "https://getiot.tech/linux-c-functions/_static/images/GetIoT_Logo_150px.png"
    }
  },
  "author": {
    "@type": "Person",
    "name": "阿基米东"
  },
  "inLanguage": "zh-CN",
  "keywords": "C语言函数,C语言参考手册,Linux C函数,C语言教程,C语言编程,字符测试,字符串转换,内存管理,文件操作,网络编程,进程管理,线程控制,信号处理,系统编程",
  "license": "MIT",
  "dateCreated": "2018",
  "dateModified": "2025"
}
'''

# 网站地图和搜索引擎优化
html_baseurl = 'https://getiot.tech/linux-c-functions/'

# 网站搜索配置
html_search_language = 'zh'
html_search_options = {
    'type': 'default',
    'lang': 'zh_CN',
    'indexer': 'sphinx.search.zh.ChineseLanguageStemmer',
}

# 网站性能优化
html_compressed = True
html_use_smartypants = True
html_use_index = True
html_split_index = False
html_copy_source = False
html_show_sourcelink = False
html_show_sphinx = False
html_show_copyright = True

# -- 代码高亮配置 -----------------------------------------------------

# 代码高亮样式 - 使用默认样式，通过 CSS 自定义
pygments_style = 'default'

# 代码块配置
highlight_language = 'c'

# 自定义 CSS 文件
html_css_files = [
    'css/custom.css'
]
